package com.example.feign.client;

import com.example.feign.result.AjaxResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;


/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86187
 * Date: 2023-09-26
 * Time: 15:46
 */
@FeignClient("bookservice")  // 指定向哪一个服务发起请求
public interface BookClient {

    @GetMapping("/book/bookIsExist/{targetBook}/{targetChapter}")
    Boolean bookIsExist(@PathVariable("targetBook") Long targetBook,
                        @PathVariable("targetChapter") Long targetChapter);


    @GetMapping("/book/getAuthorByBookId/{targetBook}")
    String getAuthorByBookId(@PathVariable("targetBook") Long targetBook);

    /**
     *  获取未审核的图书列表
     */
    @GetMapping("/book/admin/approved/book/false")
    AjaxResult getApprovedBookFalse(@RequestHeader("token") String token,
                                @RequestParam("pageNum") Integer pageNum,
                                @RequestParam("pageSize") Integer pageSize);

    /**
     *  获取未审核的章节列表
     */
    @GetMapping("/book/admin/approved/chapter/false")
    AjaxResult getApprovedChapterFalse(@RequestHeader("token") String token,
                                    @RequestParam("pageNum") Integer pageNum,
                                    @RequestParam("pageSize") Integer pageSize);

    /**
     *  审核书籍id是否正确
     * @param bookId 书籍 id
     * @param token  token
     */
    @GetMapping("/book/admin/approved/book/{bookId}")
    boolean isCorrectBookId(@PathVariable("bookId") Long bookId,
                               @RequestHeader("token") String token);

    /**
     * 审核章节id是否正确
     * @param bookId 章节 id
     * @param token  token
     */
    @GetMapping("/book/admin/approved/chapter/{chapterId}")
    boolean isCorrectChapterId(@PathVariable("chapterId") Long bookId,
                                     @RequestHeader("token") String token);
}
